package com.groupnections.shared.entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Entity
 */
public class Tags implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long tagID;

	private String tagName;

	private String tagsList;

	private List<User> userCustomers = new ArrayList<User>();

	private List<User> userProviders = new ArrayList<User>();

	public Long getTagID() {
		return tagID;
	}

	public void setTagID(Long tagID) {
		this.tagID = tagID;
	}

	public String getTagName() {
		return tagName;
	}

	public void setTagName(String tagName) {
		this.tagName = tagName;
	}

	public String getTagsList() {
		return tagsList;
	}

	public void setTagsList(String tagsList) {
		this.tagsList = tagsList;
	}

	public List<User> getUserCustomers() {
		return userCustomers;
	}

	public void setUserCustomers(List<User> userCustomers) {
		this.userCustomers = userCustomers;
	}

	public List<User> getUserProviders() {
		return userProviders;
	}

	public void setUserProviders(List<User> userProviders) {
		this.userProviders = userProviders;
	}

	public static String getStaticTags(String description, String tagsList) {

		String[] tagsArray = tagsList.split(",");

		List<String> descriptionTagsList = new ArrayList<String>();

		String descriptionTags = "";

		for (String tag : tagsArray) {

			if (description.toLowerCase().contains(tag.trim().toLowerCase())) {

				descriptionTagsList.add(tag);

				descriptionTags += tag + ",";
			}
		}

		return descriptionTags;
	}
}
